package heap

import (
	"ch06/classfile"
	"fmt"
)

type Constant interface {

}

type ConstantPool struct {
	class *Class
	constants []Constant
}


func (self *ConstantPool) GetConstant(index uint) Constant{
	if c:=self.constants[index];c!= nil {
		return c
	}

	panic(fmt.Sprintf("No constant at index %d", index))

}

func newConstantPool(class *Class,cfCp classfile.ConstantPool) *ConstantPool{
	cpCount := len(cfCp)
	constants := make([]Constant, cpCount)
	rtCp := &ConstantPool{class, constants}

	for i:=1;i<cpCount ;i++  {
		cpInfo:=cfCp[i]
		switch cpInfo.(type) {

		}
	}
	return rtCp
}
